﻿<UserControl x:Class="estoque.TracerUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:localInterface="clr-namespace:estoque;assembly=estoque.Interface"
             xmlns:local="clr-namespace:estoque"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             FlowDirection="LeftToRight"
             FontFamily="Segoe UI"
             Width="255"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <local:DateTimeConverter x:Key="DateTimeConverter"/>

        <DataTemplate DataType="{x:Type localInterface:Message}">
            <StackPanel FlowDirection="LeftToRight">
                <StackPanel Orientation="Horizontal" FlowDirection="LeftToRight">
                    <TextBlock Text="{Binding Status}"/>
                    <TextBlock Margin="5,0,0,0" Text="{Binding LogTime, Converter={StaticResource DateTimeConverter}}"/>
                </StackPanel>
                <TextBlock Text="{Binding Text}"/>
                <Rectangle Fill="DarkGray" Height="2"/>
            </StackPanel>
        </DataTemplate>

    </UserControl.Resources>
    <Grid>
        <Expander ExpandDirection="Up" x:Name="expander">
            <Expander.Header>Tracing</Expander.Header>
            <StackPanel Background="White" Margin="8" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Right">
                <ListBox ItemsSource="{Binding Messages}"/>
            </StackPanel>
        </Expander>
    </Grid>
</UserControl>